/**
**Filename: R5.h
**Authors: Maxwell Kobe, Jerry Causby, Ryan Gross
**Version: 1
**Last Modified: 12/8/2011
**/

//R5 Header File

//ERROR CODES
#define ok 0
#define ERR_SUP_INVEFP (-101) //invalid event flag pointer
#define ERR_SUP_INVBRD (-102) //invalid baud rate divisor
#define ERR_SUP_PRTOPN (-103) //port already open
#define ERR_INVALID_INT_ID (-150) //invalid interupt ID
#define ERR_SUP_PRTNOP (-201) //serial port not open


#define COM1_BASE 0x3f8 // base address
#define COM1_INT_ID 0x0c // interupt ID
#define COM1_INT_EN COM1_BASE+1 // interrupt enable
#define COM1_INT_ID_REG COM1_BASE+2//  Interruptd ID register
#define COM1_LC COM1_BASE+3//  line control
#define COM1_MC COM1_BASE+4//  modem control
#define COM1_LS COM1_BASE+5//  line status
#define COM1_MS COM1_BASE+6//  modem status

#define COM1_BRD_LSB COM1_BASE // baud rate devisor LSB
#define COM1_BRD_MSB COM1_BASE+1 // baud rate devisor MSB

#define PIC_MASK 0x21
#define PIC_CMD 0x20 
#define EOI 0x20 // end of interupt code 


int com_open(int*, int);
int com_close();
//void interrupt(*getvect(int int_ID))(void);
int com_read(char*, int*);
int com_write(char*, int*);
void interrupt io_interrupt();
void write_int_handler();
void read_int_handler();